prepare-root: get rid of a global variable
authorLuca BRUNO <luca.bruno@coreos.com>
Tue, 26 Oct 2021 16:27:22 +0000 (16:27 +0000)
committerLuca BRUNO <luca.bruno@coreos.com>
Tue, 26 Oct 2021 16:27:22 +0000 (16:27 +0000)
This moves a global mutable variable to a smaller local scope,
as it is not really used outside of that.

src/switchroot/ostree-prepare-root.c

index 20b8685da4e2682095b6a8bab0ab47c7f4fd31ed..46283f3fad502979f03c0bd69c842480e892274c 100644 (file)
@@ -81,9 +81,6 @@
 
 #include "ostree-mount-util.h"
 
-/* Initialized early in main */
-static bool running_as_pid1;
-
 static inline bool
 sysroot_is_configured_ro (const char *sysroot)
 {
@@ -175,7 +172,7 @@ main(int argc, char *argv[])
    * - Quiet logging as there's no journal
    * etc.
    */
-  running_as_pid1 = (getpid () == 1);
+  bool running_as_pid1 = (getpid () == 1);
 
   const char *root_arg = NULL;
   bool we_mounted_proc = false;